package indi.defoliation.unknownrpg.api.rpgevent.player;

import org.bukkit.entity.Item;
import org.bukkit.entity.Player;

import indi.defoliation.unknownrpg.api.attribute.Attribute;
import indi.defoliation.unknownrpg.api.rpgevent.Cancellable;

public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable{
	
	private Item item;
	
	private boolean cancel;
	
	public PlayerPickupItemEvent(Player what,Item item) {
		super(what);
		this.item=item;
	}
	
	public Item getPickupItem() {
		return item;
	}
	
	public void setPickupItem(Attribute operoter,Item item) {
		this.item=item;
		super.putLog(operoter, this.clone());
	}
	

	@Override
	public void setCancelled(Attribute operoter, boolean cance) {
		if(this.cancel==cance)
			return;
		this.cancel=cance;
		super.getTable().addAction(operoter, super.clone());
	}

	@Override
	public boolean isCancelled() {
		return cancel;
	}
}
